package functions 
{	import functions.FunctionNode;	/**	 * @author admin	 */	public class SetLiteralFunctionNode extends FunctionNode 
	{
		public function SetLiteralFunctionNode()
		{
			funcname = "setliteral";	
			functiontype = FUNCTION;
		}
		
		override public function getValue( args : XML, scope : Object ) : XML
		{

					
			//let's assume that the first arg is the name of the var
			//simple case: <q>myvarname</q>
			//more complex case: <symbol>pointerToVarName</symbol>
			//  we need a Flash String primitive here.
			
			var varname:String = Evaluator.getLiteral( args.children()[ 0 ]);
	
			// we need to extract the actual Flash literal from that node
			// in order to assign it to a literal property in our scope object.		
			var returnvalue:* = Evaluator.getLiteral( args.children()[ 1 ]);
			Evaluator.changeInScope( varname, Evaluator.getLiteral( args.children()[ 1 ]), scope );
			return args.children()[ 1 ];
		}	}}